package Test;

import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main01 {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        //数组的元素个数
        int n = input.nextInt();
        //每个区间中的元素个数
        int k = input.nextInt();
        //至少出现的次数
        int t = input.nextInt();

        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = input.nextInt();
        }

    }

    public int a(int[] arr, int k, int t) {
        int count = 0;
        if (t > k) {
            count = 0;
        }
        Map<Integer, Integer> sameElement = new HashMap<Integer, Integer>();
        for (int i = 0, j = 0; i < arr.length - k; i++) {
            j = i + k - 1;
            for (int m = i; m <= j; m++) {
                Integer sum = sameElement.get(arr[m]);
                sameElement.put(arr[i], sum == null ? 1 : sum + 1);
            }
            for(Map.Entry<Integer,Integer> entry:sameElement.entrySet()){
                if(entry.getValue()>=t){
                    count++;
                }
            }
        }
        return count;
    }
}

/*
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int k = scan.nextInt();
        int t = scan.nextInt();
        int[] arr = new int[n];
        for (int i = 0; i < n; ++i) {
            arr[i] = scan.nextInt();
        }
        int res = find(arr, k, t);
        System.out.println(res);
    }

    private static int find(int[] arr, int k, int t) {
        int res = 0;
        if (k > arr.length) {
            return res;
        }
        for (int i = 0; i < arr.length - k + 1; ++i) {
            Map<Integer, Integer> help = new HashMap<>();
            boolean bool = false;
            for (int j = 0; j < k; ++j) {
                if (help.containsKey(arr[j + i])) {
                    int e = help.get(arr[j + i]);
                    help.put(arr[j + i], e + 1);
                } else {
                    help.put(arr[j + i], 1);
                }

            }
            for (Integer value : help.values()) {
                bool = value >= t;
                if (bool) {
                    break;
                }
            }
            if (bool) {
                res++;
            }
        }
        return res;
    }
}*/


/*
import java.util.HashMap;
        import java.util.Map;
        import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scan=new Scanner(System.in);
        int n=scan.nextInt();
        int k=scan.nextInt();
        int t=scan.nextInt();
        int[] arr=new int[n];
        for (int i=0;i<n;++i){
            arr[i]=scan.nextInt();
        }
        int count=function(arr,k,t);
        System.out.println(count);
    }

    private static int function(int[] arr, int k, int t) {
        int count=0;
        //如果最少相同数比区间还大，没有对应情况
        if (k>arr.length){
            return count;
        }
        for (int i=0;i<arr.length-k+1;++i){
            Map<Integer,Integer> map=new HashMap<>();
            boolean bool=false;
            for (int j=0;j<k;++j){
                if (map.containsKey(arr[j+i])){
                    int e=map.get(arr[j+i]);
                    map.put(arr[j+i],e+1);
                }else {
                    map.put(arr[j+i],1);
                }

            }
            for (Integer value : map.values()) {
                bool=value>=t;
                if (bool){
                    break;
                }
            }
            if (bool){
                count++;
            }
        }
        return count;
    }
}*/
